package com.collabscm.md.base.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import com.collabscm.pf.BaseObject;

/**
 * 用户锁定信息
 * 
 * @author Zeng Raoxing
 */
@Entity
@Table(name = "t_md_user_lock")
public class UserLock extends BaseObject {
	private static final long serialVersionUID = 1L;
	/**人员ID*/
	@Id	private Long personId;
	/**IP地址*/
	@Id	private String ipAddr;
	/**锁定开始时间*/
	@Id private Date lockStartTime;
	/**锁定结束时间*/
	private Date lockEndTime;
	/**锁定原因类型*/
	private Long causeType;
	/**状态类型，即基本的状态类型：comm_status*/
	@Column (name="status", nullable = false)
	private Integer status;

	@Column(name = "Person_ID", nullable = false, precision = 12, scale = 0)
	public Long getPersonId() {
		return this.personId;
	}

	public void setPersonId(Long personId) {
		this.personId = personId;
	}

	@Column(name = "IP_Addr", length = 60)
	public String getIpAddr() {
		return this.ipAddr;
	}

	public void setIpAddr(String ipAddr) {
		this.ipAddr = ipAddr;
	}

	@Column(name = "Lock_Start_Time", nullable = false, length = 19)
	public Date getLockStartTime() {
		return this.lockStartTime;
	}

	public void setLockStartTime(Date lockStartTime) {
		this.lockStartTime = lockStartTime;
	}

	@Column(name = "Lock_End_Time", length = 19)
	public Date getLockEndTime() {
		return this.lockEndTime;
	}

	public void setLockEndTime(Date lockEndTime) {
		this.lockEndTime = lockEndTime;
	}

	@Column(name = "Cause_Type", precision = 2, scale = 0)
	public Long getCauseType() {
		return this.causeType;
	}

	public void setCauseType(Long causeType) {
		this.causeType = causeType;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public boolean equals(Object other) {
		if ((this == other))
			return true;
		if ((other == null))
			return false;
		if (!(other instanceof UserLock))
			return false;
		UserLock castOther = (UserLock) other;

		return ((this.getPersonId() == castOther.getPersonId()) || (this.getPersonId() != null
				&& castOther.getPersonId() != null && this.getPersonId().equals(castOther.getPersonId())))
				&& ((this.getIpAddr() == castOther.getIpAddr()) || (this.getIpAddr() != null
						&& castOther.getIpAddr() != null && this.getIpAddr().equals(castOther.getIpAddr())))
				&& ((this.getLockStartTime() == castOther.getLockStartTime()) || (this.getLockStartTime() != null
						&& castOther.getLockStartTime() != null && this.getLockStartTime().equals(
						castOther.getLockStartTime())))
				&& ((this.getLockEndTime() == castOther.getLockEndTime()) || (this.getLockEndTime() != null
						&& castOther.getLockEndTime() != null && this.getLockEndTime().equals(
						castOther.getLockEndTime())))
				&& ((this.getCauseType() == castOther.getCauseType()) || (this.getCauseType() != null
						&& castOther.getCauseType() != null && this.getCauseType().equals(castOther.getCauseType())));
	}

	public int hashCode() {
		int result = 17;

		result = 37 * result + (getPersonId() == null ? 0 : this.getPersonId().hashCode());
		result = 37 * result + (getIpAddr() == null ? 0 : this.getIpAddr().hashCode());
		result = 37 * result + (getLockStartTime() == null ? 0 : this.getLockStartTime().hashCode());
		result = 37 * result + (getLockEndTime() == null ? 0 : this.getLockEndTime().hashCode());
		result = 37 * result + (getCauseType() == null ? 0 : this.getCauseType().hashCode());
		return result;
	}
	
//	/**
//	 * UserLock的ID类
//	 *
//	 * @author Zeng Raoxing
//	 */
//	@Embeddable public static class UserLockId implements Serializable {
//		private static final long serialVersionUID = 1L;
//		
//	}
}